package game;

import com.alibaba.fastjson.JSON;
import game.kcp.KcpUtils;
import game.scene.msg.SMessage;
import game.scene.obj.Player;

/**
 * @author : [zhaojianbo]
 * @version : [v1.0]
 * @className : [MessageUtils]
 * @description :MessageUtils
 * @createTime : 2025/7/1
 */
public class MessageUtils {
    public static void sendMsg(Player player, SMessage sMsg) {
        //tcp发送
        if (player.ctx != null) {
            player.ctx.channel().writeAndFlush(sMsg);

        } else if (player.kcp != null) {
            //kcp发送
            KcpUtils.sendMsg(player.kcp, sMsg);
        }

    }
}
